🧪 Add unit test for empty __all__ tuple generation#6
Conversation
Adds `test_generate_all_tuple_empty` to `tests/test_generator.py` to directly verify that `_generate_all_tuple([])` returns `"__all__ = ()"`. This closes a testing gap in the coverage. Also fixes a failing test related to `tests/fixtures/sample_type_aliases.py` where supposed pre-Python 3.12 type aliases incorrectly used the Python 3.12 `type` syntax. Co-authored-by: bashandbone <89049923+bashandbone@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Fixes a linting error introduced in the previous commit. The `tests/fixtures/sample_type_aliases.py` file uses intentional legacy syntax to test backwards compatibility in the `ASTParser`. Ignoring rule UP040 prevents ruff from automatically rewriting these to use the new `type` keyword, avoiding tests from breaking in CI. Co-authored-by: bashandbone <89049923+bashandbone@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Updates tests and fixtures to improve coverage and ensure type-alias fixtures correctly represent both pre-3.12 and 3.12+ alias styles for the AST parser.
Changes:
- Add a unit test covering empty
__all__tuple generation. - Update the type-alias fixture to use
TypeAliasassignments for “pre-3.12” style aliases.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/test_generator.py | Adds coverage for the empty-exports __all__ tuple formatting branch. |
| tests/fixtures/sample_type_aliases.py | Corrects the “pre-3.12” fixture aliases to use TypeAlias instead of the 3.12 type statement. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Pre-3.12 style type aliases (X: TypeAlias = Y) | ||
| type FilePath = str | Path | ||
| type ModuleName = str | ||
| type RulePattern = str | ||
| type ExportName = str | ||
| type ErrorMessage = str | ||
| type ConfigDict = dict[str, str | int | bool | list[str]] | ||
| type NamePair = tuple[str, str] | ||
| from typing import TypeAlias | ||
|
|
||
| FilePath: TypeAlias = str | Path | ||
| ModuleName: TypeAlias = str |
…92330088680 Signed-off-by: Adam Poulemanos <89049923+bashandbone@users.noreply.github.com>
🎯 What: The testing gap addressed
The method
CodeGenerator._generate_all_tuplewas missing a direct test to verify that calling it with an empty sequence[]properly returns"__all__ = ()".📊 Coverage: What scenarios are now tested
Added
test_generate_all_tuple_emptyto directly test the aforementioned edge case and assert thatresult == "__all__ = ()". I also fixed a failing test related totests/fixtures/sample_type_aliases.pywhere supposed pre-Python 3.12 type aliases incorrectly used the Python 3.12typesyntax.✨ Result: The improvement in test coverage
The specific edge case is now covered directly by the unit tests.
PR created automatically by Jules for task 1988618892330088680 started by @bashandbone